package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysProjectBidevaluationMode;
import com.ruoyi.system.service.ISysProjectBidevaluationModeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 评标方法Controller
 * 
 * @author ruoyi
 * @date 2024-08-03
 */
@RestController
@RequestMapping("/system/projectbidevaluationmode")
public class SysProjectBidevaluationModeController extends BaseController
{
    @Autowired
    private ISysProjectBidevaluationModeService sysProjectBidevaluationModeService;

    /**
     * 查询评标方法列表
     */
    @PreAuthorize("@ss.hasPermi('system:projectbidevaluationmode:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysProjectBidevaluationMode sysProjectBidevaluationMode)
    {
        startPage();
        List<SysProjectBidevaluationMode> list = sysProjectBidevaluationModeService.selectSysProjectBidevaluationModeList(sysProjectBidevaluationMode);
        return getDataTable(list);
    }

    /**
     * 查询评标方法列表
     */
    @PreAuthorize("@ss.hasPermi('system:projectbidevaluationmode:lists')")
    @GetMapping("/lists")
    public AjaxResult lists(SysProjectBidevaluationMode sysProjectBidevaluationMode)
    {
        List<SysProjectBidevaluationMode> list = sysProjectBidevaluationModeService.selectSysProjectBidevaluationModeList(sysProjectBidevaluationMode);
        return success(list);
    }

    /**
     * 导出评标方法列表
     */
    @PreAuthorize("@ss.hasPermi('system:projectbidevaluationmode:export')")
    @Log(title = "评标方法", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysProjectBidevaluationMode sysProjectBidevaluationMode)
    {
        List<SysProjectBidevaluationMode> list = sysProjectBidevaluationModeService.selectSysProjectBidevaluationModeList(sysProjectBidevaluationMode);
        ExcelUtil<SysProjectBidevaluationMode> util = new ExcelUtil<SysProjectBidevaluationMode>(SysProjectBidevaluationMode.class);
        util.exportExcel(response, list, "评标方法数据");
    }

    /**
     * 获取评标方法详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:projectbidevaluationmode:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysProjectBidevaluationModeService.selectSysProjectBidevaluationModeById(id));
    }

    /**
     * 新增评标方法
     */
    @PreAuthorize("@ss.hasPermi('system:projectbidevaluationmode:add')")
    @Log(title = "评标方法", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysProjectBidevaluationMode sysProjectBidevaluationMode)
    {
        return toAjax(sysProjectBidevaluationModeService.insertSysProjectBidevaluationMode(sysProjectBidevaluationMode));
    }

    /**
     * 修改评标方法
     */
    @PreAuthorize("@ss.hasPermi('system:projectbidevaluationmode:edit')")
    @Log(title = "评标方法", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysProjectBidevaluationMode sysProjectBidevaluationMode)
    {
        return toAjax(sysProjectBidevaluationModeService.updateSysProjectBidevaluationMode(sysProjectBidevaluationMode));
    }

    /**
     * 删除评标方法
     */
    @PreAuthorize("@ss.hasPermi('system:projectbidevaluationmode:remove')")
    @Log(title = "评标方法", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysProjectBidevaluationModeService.deleteSysProjectBidevaluationModeByIds(ids));
    }
}
